﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<QianBuo.Lottery.Web.Models.Play.PlayTypeModel>" %>
<%@ Import Namespace="Code.Models" %>
<div>
    <div id="play_inputpanel">
     <%
         var RenErDanTuo = (PlayType_E)ViewData["RenErDanTuo"];
         var RenSanDanTuo = (PlayType_E)ViewData["RenSanDanTuo"];
         var RenSiDanTuo = (PlayType_E)ViewData["RenSiDanTuo"];
         var RenWuDanTuo = (PlayType_E)ViewData["RenWuDanTuo"];    
        %>
        <table border="0" cellpadding="0" cellspacing="5" class="play_play_input" align="center">
            <tr id="input_model">
                <td width="60px">
                    &nbsp;
                </td>
                <td colspan="17" align="left">
                   <input type="radio" name="inputtype" class='type<%=(int)RenErDanTuo %>'  id='任二胆拖' value='<%=(int)RenErDanTuo %>' surl='<%=Url.RouteUrl("Play_Single",new{p1=RenErDanTuo}) %>' /><label for='任二胆拖'>任二胆拖</label>
                   <input type="radio" name="inputtype" class='type<%=(int)RenSanDanTuo %>' id='任三胆拖' value='<%=(int)RenSanDanTuo %>' surl='<%=Url.RouteUrl("Play_Single",new{p1=RenSanDanTuo}) %>' /><label for='任三胆拖'>任三胆拖</label>
                   <input type="radio" name="inputtype" class='type<%=(int)RenSiDanTuo %>'  id='任四胆拖' value='<%=(int)RenSiDanTuo %>' surl='<%=Url.RouteUrl("Play_Single",new{p1=RenSiDanTuo}) %>' /><label for='任四胆拖'>任四胆拖</label>
                   <input type="radio" name="inputtype" class='type<%=(int)RenWuDanTuo %>' id='任五胆拖' value='<%=(int)RenWuDanTuo %>' surl='<%=Url.RouteUrl("Play_Single",new{p1=RenWuDanTuo}) %>' /><label for='任五胆拖'>任五胆拖</label>
                </td>
            </tr>
            <tr class="tr_number" id="p10">
                <td class="head">
                    胆码
                </td>
                <td class="number" id="1">
                    1
                </td>
                <td class="number" id="2">
                    2
                </td>
                <td class="number" id="3">
                    3
                </td>
                <td class="number" id="4">
                    4
                </td>
                <td class="number" id="5">
                    5
                </td>
                <td class="number" id="6">
                    6
                </td>
                <td class="number" id="7">
                    7
                </td>
                <td class="number" id="8">
                    8
                </td>
                <td class="number" id="9">
                    9
                </td>
                <td class="number" id="10">
                    10
                </td>
            </tr>
            <tr class="tr_number" id="p100">
                <td>
                    &nbsp;
                </td>
                <td class="number" id="11">
                    11
                </td>
                <td class="number" id="12">
                    12
                </td>
                <td class="number" id="13">
                    13
                </td>
                <td class="number" id="14">
                    14
                </td>
                <td class="number" id="15">
                    15
                </td>
                <td class="number" id="16">
                    16
                </td>
                <td class="number" id="17">
                    17
                </td>
                <td class="number" id="18">
                    18
                </td>
                <td class="number" id="19">
                    19
                </td>
                <td class="number" id="20">
                    20
                </td>
            </tr>
            <tr class="tr_number" id="p1000">
                <td class="head">
                    拖码
                </td>
                <td class="number" id="T1">
                    1
                </td>
                <td class="number" id="T2">
                    2
                </td>
                <td class="number" id="T3">
                    3
                </td>
                <td class="number" id="T4">
                    4
                </td>
                <td class="number" id="T5">
                    5
                </td>
                <td class="number" id="T6">
                    6
                </td>
                <td class="number" id="T7">
                    7
                </td>
                <td class="number" id="T8">
                    8
                </td>
                <td class="number" id="T9">
                    9
                </td>
                <td class="number" id="T10">
                    10
                </td>
            </tr>
            <tr class="tr_number" id="p10000">
            <td>&nbsp;</td>
                <td class="number" id="T11">
                    11
                </td>
                <td class="number" id="T12">
                    12
                </td>
                <td class="number" id="T13">
                    13
                </td>
                <td class="number" id="T14">
                    14
                </td>
                <td class="number" id="T15">
                    15
                </td>
                <td class="number" id="T16">
                    16
                </td>
                <td class="number" id="T17">
                    17
                </td>
                <td class="number" id="T18">
                    18
                </td>
                <td class="number" id="T19">
                    19
                </td>
                <td class="number" id="T20">
                    20
                </td>
               
            </tr>
             <tr id="playinfo">
                <td colspan="18" style="text-align:left">
                    <%=Model.Remark %>
                </td>
            </tr>
            <tr>
                <td colspan="8" id="sumcount">
                    注数:<font color="red">0</font>
                </td>
                <td colspan="10" align="left">
                    <input type="button" name="bet_play_btnadd" id="bet_play_btnadd" value="添加" class="bet_play_btnadd"
                        onclick="RenXuanDanTuo.addScheme()" />
                </td>
            </tr>
        </table>
        <script type="text/javascript">
             var __playid=<%=Model.PlayID %>;
            $(document).ready(showWinInfo);
            function showWinInfo(){
                var pwin = Site.Lottery.Bet.GetPlayTypeWinMoney(function(item){ return item.PlayTypeID == __playid;});
                if(pwin != null)
                    $('<span><%=string.IsNullOrEmpty(Model.Remark) ? "" : "，" %>'+"奖金:<font color='red'>"+pwin.WinMoney+"元</font></span>").appendTo($("#playinfo td"));
                else
                    window.setTimeout(showWinInfo,500);
            }

            $(".play_play_input .number").click(function () {
                var item = $(this);
                var id = item.parent().attr("id");
                 id=id.replace(/\s+/g,"");
                if (item.is(".select")) {
                    item.removeClass("select");
                    switch(id)
                    {
                      case"p100":
                       RenXuanDanTuo.ChooseNumber100=RenXuanDanTuo.ChooseNumber100.replace((item.text()+""),'');
                       RenXuanDanTuo.ChooseNumber100Count--;
                      break;
                      case"p10":
                      RenXuanDanTuo.ChooseNumber10=RenXuanDanTuo.ChooseNumber10.replace((item.text()+""),'');
                      RenXuanDanTuo.ChooseNumber10Count--;
                      break;
                      case"p1000":
                       RenXuanDanTuo.ChooseNumber1000=RenXuanDanTuo.ChooseNumber1000.replace((item.text()+""),'');
                       RenXuanDanTuo.ChooseNumber1000Count--;
                      break;
                      case"p1000":
                       RenXuanDanTuo.ChooseNumber10000=RenXuanDanTuo.ChooseNumber10000.replace((item.text()+""),'');
                      RenXuanDanTuo.ChooseNumber10000Count--;
                      break;
                    }
                }
                else {

                    switch (id) {                    
                    case "p100":
                        $("#任二胆拖").attr("checked", function(index, attr) {
                            if (attr == true) {
                                if ((RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count) > 0) {
                                    alert("超出选号的个数");
                                    return;
                                } else {

                                    var num = RenXuanDanTuo.ChooseNumber10000.replace((item.text() + ""), '');
                                    if (num != RenXuanDanTuo.ChooseNumber10000) {
                                        $("#T" + item.text()).removeClass("select");
                                        RenXuanDanTuo.ChooseNumber10000Count--;
                                        RenXuanDanTuo.ChooseNumber10000 = num;
                                    }

                                    RenXuanDanTuo.ChooseNumber100 += item.text() + "";
                                    RenXuanDanTuo.ChooseNumber100Count++;
                                    item.addClass("select");
                                }
                            }
                        });
                        $("#任三胆拖").attr("checked", function(index, attr) {
                            if (attr == true) {
                                if ((RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count) > 1) {
                                    alert("超出选号的个数");
                                    return;
                                } else {
                                    item.addClass("select");
                                    var num = RenXuanDanTuo.ChooseNumber10000.replace((item.text() + ""), '');
                                    if (num != RenXuanDanTuo.ChooseNumber10000) {
                                        $("#T" + item.text()).removeClass("select");
                                        RenXuanDanTuo.ChooseNumber10000Count--;
                                        RenXuanDanTuo.ChooseNumber10000 = num;
                                    }
                                    RenXuanDanTuo.ChooseNumber100 += item.text() + "";
                                    RenXuanDanTuo.ChooseNumber100Count++;
                                }
                            }
                        });
                        $("#任四胆拖").attr("checked", function(index, attr) {
                            if (attr == true) {
                                if ((RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count) > 2) {
                                    alert("超出选号的个数");
                                    return;
                                } else {
                                    item.addClass("select");
                                    var num = RenXuanDanTuo.ChooseNumber10000.replace((item.text() + ""), '');
                                    if (num != RenXuanDanTuo.ChooseNumber10000) {
                                        $("#T" + item.text()).removeClass("select");
                                        RenXuanDanTuo.ChooseNumber10000Count--;
                                        RenXuanDanTuo.ChooseNumber10000 = num;
                                    }
                                    RenXuanDanTuo.ChooseNumber100 += item.text() + "";
                                    RenXuanDanTuo.ChooseNumber100Count++;
                                }
                            }
                        });
                        $("#任五胆拖").attr("checked", function(index, attr) {
                            if (attr == true) {
                                if ((RenXuanDanTuo.ChooseNumber10Count + RenXuanDanTuo.ChooseNumber100Count) > 3) {
                                    alert("超出选号的个数");
                                    return;
                                } else {
                                    var num = RenXuanDanTuo.ChooseNumber10000.replace((item.text() + ""), '');
                                    if (num != RenXuanDanTuo.ChooseNumber10000) {
                                        $("#T" + item.text()).removeClass("select");
                                        RenXuanDanTuo.ChooseNumber10000Count--;
                                        RenXuanDanTuo.ChooseNumber10000 = num;
                                    }
                                    item.addClass("select");
                                    RenXuanDanTuo.ChooseNumber100 += item.text() + "";
                                    RenXuanDanTuo.ChooseNumber100Count++;
                                }
                            }
                        });
                        break;
                    case "p10":
                        $("#任二胆拖").attr("checked", function(index, attr) {
                            if (attr == true) {
                                if ((RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count) > 0) {
                                    alert("超出选号的个数");
                                    return;
                                } else {
                                    var num = RenXuanDanTuo.ChooseNumber1000.replace((item.text() + ""), '');
                                    if (num != RenXuanDanTuo.ChooseNumber1000) {
                                        $("#T" + item.text()).removeClass("select");
                                        RenXuanDanTuo.ChooseNumber1000Count--;
                                        RenXuanDanTuo.ChooseNumber1000 = num;
                                    }
                                    item.addClass("select");
                                    RenXuanDanTuo.ChooseNumber10 += item.text() + "";
                                    RenXuanDanTuo.ChooseNumber10Count++;
                                }
                            }
                        });
                        $("#任三胆拖").attr("checked", function(index, attr) {
                            if (attr == true) {
                                if ((RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count) > 1) {
                                    alert("超出选号的个数");
                                    return;
                                } else {
                                    var num = RenXuanDanTuo.ChooseNumber1000.replace((item.text() + ""), '');
                                    if (num != RenXuanDanTuo.ChooseNumber1000) {
                                        $("#T" + item.text()).removeClass("select");
                                        RenXuanDanTuo.ChooseNumber1000Count--;
                                        RenXuanDanTuo.ChooseNumber1000 = num;
                                    }
                                    item.addClass("select");
                                    RenXuanDanTuo.ChooseNumber10 += item.text() + "";
                                    RenXuanDanTuo.ChooseNumber10Count++;
                                }
                            }
                        });
                        $("#任四胆拖").attr("checked", function(index, attr) {
                            if (attr == true) {
                                if ((RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count) > 2) {
                                    alert("超出选号的个数");
                                    return;
                                } else {
                                    var num = RenXuanDanTuo.ChooseNumber1000.replace((item.text() + ""), '');
                                    if (num != RenXuanDanTuo.ChooseNumber1000) {
                                        $("#T" + item.text()).removeClass("select");
                                        RenXuanDanTuo.ChooseNumber1000Count--;
                                        RenXuanDanTuo.ChooseNumber1000 = num;
                                    }
                                    item.addClass("select");
                                    RenXuanDanTuo.ChooseNumber10 += item.text() + "";
                                    RenXuanDanTuo.ChooseNumber10Count++;
                                }
                            }
                        });
                        $("#任五胆拖").attr("checked", function(index, attr) {
                            if (attr == true) {
                                if ((RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count) > 3) {
                                    alert("超出选号的个数");
                                    return;
                                } else {
                                    var num = RenXuanDanTuo.ChooseNumber1000.replace((item.text() + ""), '');
                                    if (num != RenXuanDanTuo.ChooseNumber1000) {
                                        $("#T" + item.text()).removeClass("select");
                                        RenXuanDanTuo.ChooseNumber1000Count--;
                                        RenXuanDanTuo.ChooseNumber1000 = num;
                                    }
                                    item.addClass("select");
                                    RenXuanDanTuo.ChooseNumber10 += item.text() + "";
                                    RenXuanDanTuo.ChooseNumber10Count++;
                                }
                            }
                        });
                        break;
                    case "p1000":
                        var num = RenXuanDanTuo.ChooseNumber10.replace((item.text() + ""), '');
                        if (num != RenXuanDanTuo.ChooseNumber10) {
                            $("#" + item.text()).removeClass("select");
                            RenXuanDanTuo.ChooseNumber10Count--;
                            RenXuanDanTuo.ChooseNumber10 = num;
                        }
                        item.addClass("select");
                        RenXuanDanTuo.ChooseNumber1000 += item.text() + "";
                        RenXuanDanTuo.ChooseNumber1000Count++;
                        break;
                    case "p10000":
                        var num = RenXuanDanTuo.ChooseNumber100.replace((item.text() + ""), '');

                        if (num != RenXuanDanTuo.ChooseNumber100) {
                            $("#" + item.text()).removeClass("select");
                            RenXuanDanTuo.ChooseNumber100Count--;
                            RenXuanDanTuo.ChooseNumber100 = num;
                        }
                        item.addClass("select");
                        RenXuanDanTuo.ChooseNumber10000 += item.text() + "";
                        RenXuanDanTuo.ChooseNumber10000Count++;
                        break;
                    }
                }

                var count = RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count;
                var counynum=RenXuanDanTuo.ChooseNumber1000Count + RenXuanDanTuo.ChooseNumber10000Count;

              $("#任二胆拖").attr("checked", function(index, attr) {
                 if (attr == true) {
                $(".play_play_input #sumcount font").html('0');
                $(".play_play_input #sumcount font").html((RenXuanDanTuo.ChooseNumber1000Count+RenXuanDanTuo.ChooseNumber10000Count)*(RenXuanDanTuo.ChooseNumber100Count+RenXuanDanTuo.ChooseNumber10Count));
               }
               });
                $("#任三胆拖").attr("checked", function(index, attr) {
                 if (attr == true) {
                 $(".play_play_input #sumcount font").html('0');
                   var result=0;
                     
                     if(count==1&&counynum>1)
                     {
                     var n=1;
                         for (var a = counynum-1; a <= counynum; a++) {
                             n = n * a;
                        }
                       var m=1;
                      for(var i=1;i<3;i++)
                      {
                       m=m * i;
                      }
                       result=n/m;
                      
                     }
                     if(count==2 &&counynum>0)
                     {
                       result=counynum;
                     }
                     if(count==0||(counynum+count)<3)
                     {
                        result=0;
                     }

                    $(".play_play_input #sumcount font").html(result);
                 } });
                   $("#任四胆拖").attr("checked", function(index, attr) {
                  
                 if (attr == true) {
                  var result=0;
                   if(count==1 && counynum>2)
                   {
                        var n = 1;
                    for (var a = counynum-2; a <= counynum; a++) {
                             n = n * a;
                        }
                   var m=1;
                   for(var i=1;i<4;i++)
                   {
                       m=m * i;
                   }
                   result=n/m;
                    
                   }
                   if(count==2 && counynum>1)
                   {
                            var n = 1;
                    for (var a = counynum-1; a <= counynum; a++) {
                             n = n * a;
                        }
                   var m=1;
                   for(var i=1;i<3;i++)
                   {
                       m=m * i;
                   }
                   result=n/m;
                   }
                   if(count==3 && counynum>0)
                   {
                      result=counynum;
                   }
                   if(count=0 ||(count+counynum)<4)
                   {
                     result=0;
                   }
                    $(".play_play_input #sumcount font").html(result);
                 } });
                $("#任五胆拖").attr("checked", function(index, attr) {

                    if (attr == true) {
                        $(".play_play_input #sumcount font").html('0');
                        var result = 0;
                        if (count == 1 && counynum > 3) {
                            var n = 1;
                            for (var a = counynum - 3; a <= counynum; a++) {
                                n = n * a;
                            }
                            var m = 1;
                            for (var i = 1; i < 5; i++) {
                                m = m * i;
                            }
                            result = n / m;
                        }
                        if (count == 2 && counynum > 2) {
                            var n = 1;
                            for (var a = counynum - 2; a <= counynum; a++) {
                                n = n * a;
                            }
                            var m = 1;
                            for (var i = 1; i < 4; i++) {
                                m = m * i;
                            }
                            result = n / m;
                        }
                        if (count == 3 && counynum > 1) {
                            var n = 1;
                            for (var a = counynum - 1; a <= counynum; a++) {
                                n = n * a;
                            }
                            var m = 1;
                            for (var i = 1; i < 3; i++) {
                                m = m * i;
                            }
                            result = n / m;
                        }
                        if (count == 4 && counynum > 0) {
                            result = counynum;
                        }
                        if (count == 0 || (count + counynum) < 5) {
                            result = 0;
                        }

                        $(".play_play_input #sumcount font").html(result);
                    }
                });
            });
            RenXuanDanTuo={};
            RenXuanDanTuo.ChooseNumber=[];
            RenXuanDanTuo.PlayModels=[];
            RenXuanDanTuo.ChooseNumber100="";
            RenXuanDanTuo.ChooseNumber10="";
            RenXuanDanTuo.ChooseNumber1000="";
            RenXuanDanTuo.ChooseNumber10000="";
            RenXuanDanTuo.ChooseNumber10Count=0;
            RenXuanDanTuo.ChooseNumber100Count=0;
            RenXuanDanTuo.ChooseNumber1000Count=0;
            RenXuanDanTuo.ChooseNumber10000Count=0;
            RenXuanDanTuo.PlayID=<%=Model.ID %>;
            
            RenXuanDanTuo.PlayName='<%=Model.Name%>';
            RenXuanDanTuo.SetCurrentPlay = function(id, name) {
                RenXuanDanTuo.PlayID = id;
                RenXuanDanTuo.PlayName = name;

                Site.Lottery.Bet.SetCurrentPlay(RenXuanDanTuo.PlayID, RenXuanDanTuo.PlayName);
            };

            RenXuanDanTuo.addScheme = function() {
                var count = RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count;
                var counynum = RenXuanDanTuo.ChooseNumber1000Count + RenXuanDanTuo.ChooseNumber10000Count;
                if (count == 0 || counynum == 0) {
                    alert('号码选择不正确！');
                    return;
                }

                var choose = RenXuanDanTuo.ChooseNumber10 + RenXuanDanTuo.ChooseNumber100;

                var number = choose.substring(0, choose.lastIndexOf(" ")) + "," + RenXuanDanTuo.ChooseNumber1000 + RenXuanDanTuo.ChooseNumber10000;
                number = number.substring(0, number.lastIndexOf(" "));

                var count = RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count;
                var counynum = RenXuanDanTuo.ChooseNumber1000Count + RenXuanDanTuo.ChooseNumber10000Count;
                RenXuanDanTuo.PlayModels['任二胆拖'] = { ID: '<%=(int)ViewData["RenErDanTuo"] %>', Name: '<%=((PlayType_E)ViewData["RenErDanTuo"]).GetName() %>', Numbers: '' };
                RenXuanDanTuo.PlayModels['任三胆拖'] = { ID: '<%=(int)ViewData["RenSanDanTuo"] %>', Name: '<%=((PlayType_E)ViewData["RenSanDanTuo"]).GetName() %>', Numbers: '' };
                RenXuanDanTuo.PlayModels['任四胆拖'] = { ID: '<%=(int)ViewData["RenSiDanTuo"] %>', Name: '<%=((PlayType_E)ViewData["RenSiDanTuo"]).GetName() %>', Numbers: '' };
                RenXuanDanTuo.PlayModels['任五胆拖'] = { ID: '<%=(int)ViewData["RenWuDanTuo"] %>', Name: '<%=((PlayType_E)ViewData["RenWuDanTuo"]).GetName() %>', Numbers: '' };
                if (Site.Lottery.Bet) {
                    $("#任三胆拖").attr("checked", function(index, attr) {
                        if (attr == true) {
                            var result = 0;

                            if (count == 1 && counynum > 1) {
                                var n = 1;
                                for (var a = counynum - 1; a <= counynum; a++) {
                                    n = n * a;
                                }
                                var m = 1;
                                for (var i = 1; i < 3; i++) {
                                    m = m * i;
                                }
                                result = n / m;

                            }
                            if (count == 2 && counynum > 0) {
                                result = counynum;
                            }
                            if (count == 0 || (counynum + count) < 3) {
                                result = 0;
                            }
                            Site.Lottery.Bet.AddPlayItem(RenXuanDanTuo.PlayModels["任三胆拖"].ID, RenXuanDanTuo.PlayModels["任三胆拖"].Name, number, result, 1)
                        }
                    });
                    $("#任四胆拖").attr("checked", function(index, attr) {
                        if (attr == true) {

                            var result = 0;
                            if (count == 1 && counynum > 2) {
                                var n = 1;
                                for (var a = counynum - 2; a <= counynum; a++) {
                                    n = n * a;
                                }
                                var m = 1;
                                for (var i = 1; i < 4; i++) {
                                    m = m * i;
                                }
                                result = n / m;

                            }
                            if (count == 2 && counynum > 1) {
                                var n = 1;
                                for (var a = counynum - 1; a <= counynum; a++) {
                                    n = n * a;
                                }
                                var m = 1;
                                for (var i = 1; i < 3; i++) {
                                    m = m * i;
                                }
                                result = n / m;
                            }
                            if (count == 3 && counynum > 0) {
                                result = counynum;
                            }
                            if (count == 0 || (count + counynum) < 4) {
                                result = 0;
                            }
                            Site.Lottery.Bet.AddPlayItem(RenXuanDanTuo.PlayModels["任四胆拖"].ID, RenXuanDanTuo.PlayModels["任四胆拖"].Name, number, result, 1)
                        }
                    });
                    $("#任五胆拖").attr("checked", function(index, attr) {
                        if (attr == true) {

                            var result = 0;
                            if (count == 1 && counynum > 3) {
                                var n = 1;
                                for (var a = counynum - 3; a <= counynum; a++) {
                                    n = n * a;
                                }
                                var m = 1;
                                for (var i = 1; i < 5; i++) {
                                    m = m * i;
                                }
                                result = n / m;
                            }
                            if (count == 2 && counynum > 2) {
                                var n = 1;
                                for (var a = counynum - 2; a <= counynum; a++) {
                                    n = n * a;
                                }
                                var m = 1;
                                for (var i = 1; i < 4; i++) {
                                    m = m * i;
                                }
                                result = n / m;
                            }
                            if (count == 3 && counynum > 1) {
                                var n = 1;
                                for (var a = counynum - 1; a <= counynum; a++) {
                                    n = n * a;
                                }
                                var m = 1;
                                for (var i = 1; i < 3; i++) {
                                    m = m * i;
                                }
                                result = n / m;
                            }
                            if (count == 4 && counynum > 0) {
                                result = counynum;
                            }
                            if (count == 0 || (count + counynum) < 5) {
                                result = 0;
                            }
                            Site.Lottery.Bet.AddPlayItem(RenXuanDanTuo.PlayModels["任五胆拖"].ID, RenXuanDanTuo.PlayModels["任五胆拖"].Name, number, result, 1)
                        }
                    });
                    $("#任二胆拖").attr("checked", function(index, attr) {
                        if (attr == true) {

                            Site.Lottery.Bet.AddPlayItem(RenXuanDanTuo.PlayID, "任二胆拖", number, (RenXuanDanTuo.ChooseNumber1000Count + RenXuanDanTuo.ChooseNumber10000Count) * (RenXuanDanTuo.ChooseNumber100Count + RenXuanDanTuo.ChooseNumber10Count), 1)
                        }
                    });
                }
                $(".number").removeClass("select");
                RenXuanDanTuo.ChooseNumber100 = "";
                RenXuanDanTuo.ChooseNumber10 = "";
                RenXuanDanTuo.ChooseNumber1000 = "";
                RenXuanDanTuo.ChooseNumber10000 = "";
                RenXuanDanTuo.ChooseNumber10Count = 0;
                RenXuanDanTuo.ChooseNumber100Count = 0;
                RenXuanDanTuo.ChooseNumber1000Count = 0;
                RenXuanDanTuo.ChooseNumber10000Count = 0;
                $(".play_play_input #sumcount font").html('0');
                $(".play_play_input .tool:contains('清')").click();
            };
            
            RenXuanDanTuo.PlayModels['任二胆拖'] = {ID:'<%=(int)ViewData["RenErDanTuo"] %>',Name:'<%=((PlayType_E)ViewData["RenErDanTuo"]).GetName() %>',Numbers:''};
            RenXuanDanTuo.PlayModels['任三胆拖'] = {ID:'<%=(int)ViewData["RenSanDanTuo"] %>',Name:'<%=((PlayType_E)ViewData["RenSanDanTuo"]).GetName() %>',Numbers:''};
            RenXuanDanTuo.PlayModels['任四胆拖'] = {ID:'<%=(int)ViewData["RenSiDanTuo"] %>',Name:'<%=((PlayType_E)ViewData["RenSiDanTuo"]).GetName() %>',Numbers:''};
            RenXuanDanTuo.PlayModels['任五胆拖'] = {ID:'<%=(int)ViewData["RenWuDanTuo"] %>',Name:'<%=((PlayType_E)ViewData["RenWuDanTuo"]).GetName() %>',Numbers:''};
            var isSingle=<%="true".Equals(TempData["singleplay"] as string)?"true":"false" %>;
            $("#input_model :radio").each(function() {
                var item = $(this)
                item.click(function() {
                    var val = parseInt(this.value);
                    $(".play_play_input #sumcount font").html('0');
                    RenXuanDanTuo.ChooseNumber100 = "";
                    RenXuanDanTuo.ChooseNumber10 = "";
                    RenXuanDanTuo.ChooseNumber1000 = "";
                    RenXuanDanTuo.ChooseNumber10000 = "";
                    RenXuanDanTuo.ChooseNumber10Count = 0;
                    RenXuanDanTuo.ChooseNumber100Count = 0;
                    RenXuanDanTuo.ChooseNumber1000Count = 0;
                    RenXuanDanTuo.ChooseNumber10000Count = 0;
                    $(".number").removeClass("select");
                    var play = RenXuanDanTuo.PlayModels[this.id];
                    if (this.value == -1){
                        $(".play_play_input #sumcount font").html('0'); 
                        RenXuanDanTuo.SetCurrentPlay(play.ID, play.Name);
                    } else {
                        $(".play_play_input #input_" + this.value + " .number:first").click().click();

                        if (RenXuanDanTuo.PlayID == val) {
                            RenXuanDanTuo.SetCurrentPlay(play.ID, play.Name);
                            return;
                        }
                        if (isSingle) {
                            location.href = item.attr('surl');
                            return;
                        }
                        var url = '<%=Url.Action("Play",new {p1="!"}) %>/'.replace("!", val);
                        $("#play_bet_bar").block({ message: "<img src='<%=Url.Content("~/Content/images/busy.gif") %>'/>载入中...", css: { cursor: "default" }, overlayCSS: { cursor: "default" } });
                        $("#play_bet_bar").load(url, null, function(p, e, i) {
                            $("#play_bet_bar").unblock();
                            if (e == 'success' && $(p).has("#play_inputpanel")) {
                            } else {
                                $("#input_model .type" + val).click();
                                return false;
                            }
                        });
                    }
                });
                if (RenXuanDanTuo.PlayID == parseInt(item.val()))
                    this.checked = true;
            });
            $("#input_model :radio:checked").click();
        </script>
    </div>
</div>
